package cn.kgc.springcloud.controller;

import cn.kgc.springcloud.client.OrderClient;
import cn.kgc.springcloud.entity.Order;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: mosin
 * @version: v1.0  2023/1/4
 */
@RestController
@RequestMapping("user")
public class UserController {

    @Autowired
    private OrderClient orderClient;

    @RequestMapping("m1")
    public String method1(){
        String s = orderClient.method1();
        return "userService ok :" +s;
    }


    @RequestMapping("m2")
    public String method2(Integer id){
        System.out.println("id = " + id);
        String s = orderClient.method2(id);
        return "userService ok :" +s;
    }

    @RequestMapping("m3")
    public String method3(Integer id){
        System.out.println("id = " + id);
        String s = orderClient.method3(id);
        return "userService ok :" +s;
    }

    @RequestMapping("m4")
    public String method4(){
        Order order = new Order();
        order.setId(20);
        order.setName("笔记本");
        String s = orderClient.method4(order);
        return "userService ok :" +s;
    }

    @RequestMapping("m5")
    public String method4(Integer id){
        Order order = orderClient.method5(id);
        System.out.println("order = " + order);
        return "userService ok :" +order;
    }
}
